<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>首页</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../css/vant.css">
    <style>
        html,body,.app{
            background: #fff;
        }
    </style>
</head>
<body>
    <div class="app" v-cloak>
        <div class="qz">
            <div class="qz-title">{{detailItem.title}}</div>
            <div class="flex-x-s flex-wrap">
                <div class="qz-type">{{detailData.publisherType === 0?'平台':detailData.publisherType === 1?'个人':'商家'}}</div>
                <div class="qz-type" v-for="item in detailData.tags" @click="goTagDetail(item)">{{item.name}}</div>
            </div>
            <div class="qz-detail">
                <div class="qz-detail-f1">
                    <div class="qz-detail-f1-txt">
                        <div>机械类型</div>
                        <div>{{detailData.typeName}}</div>
                    </div>
                    <div class="qz-detail-f1-txt">
                        <div>机械品牌</div>
                        <div>{{detailData.brandName}}</div>
                    </div>
                </div>
                <div class="qz-detail-f2">
                    <div class="qz-detail-f2-txt">
                        <div>机械型号</div>
                        <div> {{detailData.modelName}}</div>
                    </div>
                </div>
                <div class="qz-detail-f2">
                    <div class="qz-detail-f2-txt">
                        <div>所在地区</div>
                        <div> {{detailData.addressName}}</div>
                    </div>
                </div>
                <div class="qz-detail-f2">
                    <div class="qz-detail-f2-txt" v-if="title=='BUY_DEVICE'">
                        <!-- <div>生产年份</div>
                        <div> {{detailData.deliveryDate | handleTimePlus('//')}}</div> -->
                    </div>
                    <!-- <div class="qz-detail-f2-txt" v-else>
                        <div>租赁时间</div>
                        <div> {{detailData.rentBeginTime | handleTimePlus('//')}} - {{detailData.rentEndTime | handleTimePlus('//')}}</div>
                    </div> -->
                </div>
            </div>
            <div class="qz-intro">
                <div>描述</div>
                <pre>{{detailData.intro}}</pre>
            </div>
        </div>
    </div>
    <script src="../../script/api.js"></script>
    <script src="../../script/flexible.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/iconfont.js"></script>
    <script src="../../script/vant.min.js"></script>
    <script src="../../script/restful.js"></script>
    <script src="../../script/common.js"></script>
    <script src="../../script/businessCommon.js"></script>
    <script>
        apiready = function() {
            vm = new Vue({
                el: '.app',
                data() {
                    return {
                        detailItem: api.pageParam.detailItem || api.pageParam,
                        detailData: {
                            publisherType: 0,
                            categoryName: '',
                            brandName: '',
                            typeName: '',
                            modelName: '',
                            address: '',
                            addressName: '',
                            deliveryDate: '',
                            intro: ''
                        },
                        title:''
                    }
                },
                created() {
                },
                filters:{
                    handleTimePlus:handleTimePlus
                },
                mounted: function() {
                    this.title = api.pageParam.title
                    var vm = this
                    index.equipment("getEquipmentDetail")(this.detailItem.id, function(ret) {
                        vm.detailData = ret.data
                    })
                },
                methods: {
                    goTagDetail(item){
                        api.openWin({
                            name: 'tag_win',
                            url: '../common/tag_win.html',
                            bounces: false,
                            pageParam: {item : item}
                        });
                    },
                    call(){
                        var phone = this.detailData.phone.split(',')
                        api.actionSheet({
                            cancelTitle: '取消',
                            buttons: phone
                        },function(ret,err){
                            if(ret.buttonIndex > phone.length) return false;
                            api.call({
                                type: 'call_type',
                                number: phone[ret.buttonIndex-1]
                            });
                        });
                    },
                },
            })
            api.addEventListener({
                name: 'sendRentDetail'
            }, function(ret, err){
                if (!checkToken()) return false;
                vm.call()
            });
        }
    </script>
</body>

</html>